﻿using System;

namespace Jet.Dal
{
	/// <summary>
	/// Repository which stores entities of one type.
	/// </summary>
	/// <typeparam name="TEntity">Type of stored entity</typeparam>
	public interface ICrudRepository<in TEntity>
		where TEntity : class
	{
		/// <summary>
		/// Insert an entity
		/// </summary>
		/// <exception cref="ArgumentNullException">If entity is null</exception>
		void Insert(TEntity entity);


		/// <summary>
		/// Updates the entity an entity
		/// </summary>
		/// <exception cref="ArgumentNullException">If entity is null</exception>
		void Update(TEntity entity);

		/// <summary>
		/// Delete an entity
		/// </summary>
		/// <exception cref="ArgumentNullException">If entity is null</exception>
		void Delete(TEntity entity);
	}
}
